////  Sever --> Client 的单向通讯  
//var net = require('net');  
//
//var chatServer = net.createServer();  
//
//chatServer.on('connection', function(clientSocket) {  
//	console.log('有链接')
//clientSocket.write('Hi!\n'); // 服务端向客户端输出信息，使用 write() 方法  
//clientSocket.write('Bye!\n');  
//clientSocket.on('data', function (data) {
//	console.log('来了消息' + JSON.stringify(data))
//})
//clientSocket.on('message', function (data) {
//	console.log('来了消息message====' + JSON.stringify(data))
//})
////clientSocket.end(); // 服务端结束该次会话  
//});  
//
//chatServer.listen(9000); 

const net = require('net');
const server = net.createServer((clientSocket) => {
	// 'connection' listener
	console.log('client connected');
	clientSocket.on('end', () => {
		console.log('client disconnected');
	});
//	clientSocket.write('hello\r\n');
//	clientSocket.pipe(clientSocket);
});
server.on('error', (err) => {
	throw err;
});
server.listen(8124, () => {
  console.log('server bound');
});
	